package org.bukkit.pm.arena;

import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.vehicle.VehicleListener;
import org.bukkit.event.vehicle.VehicleMoveEvent;

public class ArenaVehicleListener extends VehicleListener {

	private ArenaPlugin _plugin;
	
	public ArenaVehicleListener(ArenaPlugin plugin) {
		_plugin = plugin;
	}
	
	public void onVeihcleMove(VehicleMoveEvent event){
		Entity e = event.getVehicle().getPassenger();
		if(e instanceof Player){
			Player p = (Player)e;
			if(!_plugin.checkBounds(p)){
				p.teleportTo(event.getFrom());
			}
		}
	}
}
